package com.midea.ai.air.ui.more;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.midea.ai.air.R;
import com.midea.ai.air.common.BaseActivity;
import com.midea.ai.air.view.MyTitleBar;

/**
 * Created by hww on 2016/3/24.
 * 更多-设置-检查更新
 */
public class MoreSettingSoftwareUpdate extends BaseActivity implements View.OnClickListener {

    private LinearLayout loading_ll, show_ll;
    private RelativeLayout relativeLayout;

    private static final int SHOW_SUCCESS = 0X110;


    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case SHOW_SUCCESS:
                    relativeLayout.setVisibility(View.VISIBLE);
                    show_ll.setVisibility(View.VISIBLE);
                    loading_ll.setVisibility(View.GONE);
                    break;
                default:
                    break;
            }
        }
    };


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_moresettingsoftwareupdate);

        init();
    }

    private TextView actionbar_left_tv;
    MyTitleBar myTitleBar;

    private void init() {
        myTitleBar = new MyTitleBar(this);
        myTitleBar.setActionBar_center(R.string.more_setting_software_update);
        myTitleBar.setActioBar_left(true, R.drawable.register_titler_left, R.string.action_settings);
        myTitleBar.setActionBar_right(false, 0);

        actionbar_left_tv = (TextView) findViewById(R.id.actionbar_tv_left);
        actionbar_left_tv.setTextColor(getResources().getColor(R.color.electric_histogram));
        loading_ll = (LinearLayout) findViewById(R.id.more_setting_software_update_linearLayout_loading);
        show_ll = (LinearLayout) findViewById(R.id.more_setting_software_update_linearLayout_content);
        relativeLayout = (RelativeLayout) findViewById(R.id.more_setting_software_update_relativeLayout);

        relativeLayout.setVisibility(View.GONE);
        show_ll.setVisibility(View.GONE);
        loading_ll.setVisibility(View.VISIBLE);

        handler.sendEmptyMessageDelayed(SHOW_SUCCESS, 1000);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.actionbar_left_relativeLayout:
                //取消
                finish();
                break;

            default:
                break;
        }
    }
}
